/**
 * 
 */
package com.google.code.cisx.store.jpa;

import com.google.inject.Provider;

import java.util.HashMap;

import javax.persistence.EntityManager;
import javax.persistence.Persistence;

/**
 * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
 * 
 */
public class JpaProvider implements Provider<EntityManager> {

  private static final String PERSISTENCE_UNIT__STORE = "cisx-store";

  /**
   * {@inheritDoc}
   * 
   * @see com.google.inject.Provider#get()
   */
  public EntityManager get() {
    // Create and return an Entity Manager.
    EntityManager entityManager = Persistence.createEntityManagerFactory(
        PERSISTENCE_UNIT__STORE, new HashMap<String, String>()).createEntityManager();
    return entityManager;
  }

}
